home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / info-service / gopher / Unix / gateways / techinfo / gophtech / stats < prev    next >
Encoding:
Text File  |  1993-03-01  |  936 b   |  38 lines

  1. #!/bin/csh -f
  2.  
  3. set logfile = "$1"
  4. set tmp     = /tmp/connections.$$
  5. set tmp2     = /tmp/connections.$$.2
  6.  
  7. if ("$logfile" == "") then
  8.     echo "Usage: $0 <logfilename>"
  9.     exit -1
  10. endif
  11.  
  12. echo -n "GophTech Gateway requests: "
  13. grep -c :Request: $logfile 
  14.  
  15. exit
  16.  
  17. awk -F: '{print $3}' | grep -vi '^localhost$' | grep -vi '^stdin$' | grep -vi '^getpeername' > $tmp
  18.  
  19. set numconn   = `wc -l $tmp | awk '{print $1}'`
  20. set upennconn = `grep -ic 'upenn.edu$' $tmp`
  21. set nonupenn  = `grep -vic 'upenn.edu$' $tmp`
  22.  
  23. echo "Number of connections: $numconn"
  24. echo "    UPENN connections: $upennconn"
  25. echo "Non UPENN connections: $nonupenn"
  26.  
  27.  
  28. set quote = '"'
  29. set dollar = '$'
  30.  
  31. echo "\
  32. Count of requests from non-UPENN hosts:"
  33.  
  34. sort -f -u $tmp  | grep -vi 'upenn.edu$' | awk "{ printf (${quote}echo -n %s: ; grep -ic ^%s${dollar} $tmp\n${quote}, ${dollar}0, ${dollar}0 ) }" | csh -f | sort -r -t: -n +1 -2 | awk -F: '{printf ("%6d  %s\n", $2, $1) }'
  35.  
  36. rm -f $tmp
  37.  
  38.